package Gather.SetExercise;

/**
 * ClassName:HashSetText002
 * Package:Gather.SetExercise
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/2/9-12:04
 * @Version:v1.0
 */
public class HashSetText002 {
    public static void main(String[] args) {
        //创建对象
        Student s1 = new Student("zhangsan",24);
        Student s2 = new Student("lisi",25);
        Student s3 = new Student("lisi",25);
        //如果没有重写hashCode方法,不同对象计算出的哈希值是不同的
        //如果已经重写了hashCode方法,不同对象只要属性值相同,计算出来的哈希值就是一样的
        System.out.println(s1.hashCode());//363771819    重写hashCode//-1461067291
        System.out.println(s2.hashCode());//2065951873   重写hashCode//102983079
        System.out.println(s3.hashCode());//102983079
    }
}
